/* svnNotifier.h */

/*
 * Licensed to the ConArtist Development Team (CADT).
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 * The CADT licenses this file to you under the Apache License, 
 * Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SVN_NOTIFIER_H
#define SVN_NOTIFIER_H

/* APR includes */
#include "apr_pools.h"
#include "apr_network_io.h"
#include "apr_general.h"
#include "apr_tables.h"
#include "apr_poll.h"
#include "apr_errno.h"
#include "apr_strings.h"

/* SVN includes */
#include "svn_cmdline.h"
#include "svn_repos.h"
#include "svn_pools.h"
#include "svn_fs.h"

#define SVN_NOTIFY_REMOTE    7543
#define SVN_NOTIFY_LOCAL     7544

/* The Daemon process will maintain a very simple log. */
#define SVN_NOTIFY_LOG_NAME "daemon_log"

/* Log level */
#define N_ERR   1
#define N_WARN  2
#define N_INFO  3
#define N_DEBUG 4

/* Which part of the daemon that is logging */
#define N_SETUP    1
#define N_RUNNING  2
#define N_HANDLER  3

struct interestedParty {
    struct interestedParty *next;
    apr_pool_t             *pool;
    struct apr_sockaddr_t  *sa;
    unsigned char           uniqueId[32];
    apr_table_t            *repos;    
};

/* Internal utility functions that are available in svnNotifierUtil.c */
void nLog(int, int, apr_pool_t *, const char *, ...);
void nLogOpen(const char *);
void nLogClose(void);
void nLogLevel(const char *);

apr_status_t makeInterestedParty(struct interestedParty **, apr_sockaddr_t *,
                                 apr_pool_t *);
int checkInterestedParty(struct interestedParty *, struct interestedParty *,
                         struct interestedParty **);
svn_error_t *getSVNDirsChanged(svn_repos_node_t **, const char *, 
                               svn_revnum_t, apr_pool_t *);

#endif /* SVN_NOTOFIER_H */
